package main

import (
	"fmt"
)

func longestCommonPrefix(strs []string) string {
	if len(strs) == 0 {
		return ""
	}
	base := strs[0]
	for i := 1; i < len(strs); i++ {
		j := 0
		for j = 0; j < len(base) && j < len(strs[i]); j++ {
			if base[j] != strs[i][j] {
				break
			}
		}
		base = base[:j]
	}
	return base
}

func main() {
	strs := []string{"ccac", "ccbd"}
	fmt.Println(longestCommonPrefix(strs))
}
